class PerfilJugador:
    def __init__(self, id, raza="robot"):
        self.id = id
        self.raza = raza
        self.dinero = 0
        self.level = 1
        self.exp = 0
    def level_up(self):
        self.level += 1
    def ganar_exp(self, value):
        self.exp += value
        if self.exp > self.level * 100:
            self.exp = 0
            self.level_up()

class Cuadro:
    def __init__(self, fila, columna):
        if fila > 5 or fila < 0:
            raise AttributeError("El valor de la 'fila' debe estar en el rango [0...5]")
        elif columna < 0 or columna > 7:
            raise AttributeError("El valor de la 'columna' debe estar en el rango [0...7]")
        self.fila = fila
        self.columna = columna
        self.x = -50
        self.y = -40
        self.unidad = None
        for i in range(8):
            self.x += 100
            if i == self.columna:
                break
        for j in range(6):
            self.y += 120
            if j == self.fila:
                break
        self.rangex = range(self.x-49, self.x + 50)
        self.rangey = range(self.y-59, self.y + 60)
    def contiene_a(self, x, y):
        if x in self.rangex and y in self.rangey: return True
        else: return False

class Tablero:
    def __init__(self):
        self.matriz = [[], [], [], [], [], []]
        self.lineas = [Linea(0), Linea(1), Linea(2), Linea(3), Linea(4), Linea(5)]
        c = 0
        for fila in self.matriz:
            for i in range(0, 8):
                fila.append(Cuadro(c, i))
            c += 1
    def get_cuadro_at(self, x, y):
        for fila in self.matriz:
            for cuadro in fila:
                if cuadro.contiene_a(x, y): return cuadro
    def get_linea_at(self, x, y):
        if y in range(21, 140): guia = 0
        elif y in range(141, 260): guia = 1
        elif y in range(261, 380): guia = 2
        elif y in range(381, 500): guia = 3
        elif y in range(501, 620): guia = 4
        elif y in range(621, 740): guia = 5
        return self.lineas[guia]

class Linea:
    def __init__(self, fila):
        self.fila = fila
        self.y = -40
        self.unidades = []
        for j in range(6):
            self.y += 120
            if j == self.fila:
                break